<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>编辑简历 - ShakesBeare</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="Hosting Store Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template,
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
    <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>

    <link href="${pageContext.request.contextPath}/static/home/css/bootstrap.css" rel='stylesheet' type='text/css' />
    <link href='${pageContext.request.contextPath}/static/home/css/font-awesome.css' rel='stylesheet' type='text/css'/>
    <script src="${pageContext.request.contextPath}/static/home/js/jquery-1.11.1.min.js"></script>
    <!-- Custom Theme files -->
    <link href="${pageContext.request.contextPath}/static/home/css/style.css" rel='stylesheet' type='text/css' />

    <link href="${pageContext.request.contextPath}/static/home/css/edit_resume_css.css" rel='stylesheet' type='text/css' />
    <!-- Custom Theme files -->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/admin/css/bootstrap-datetimepicker.min.css">

    <!-- webfonts -->
    <!-- webfonts -->
    <!-- dropdown -->

    <link href="${pageContext.request.contextPath}/static/home/css/nav.css" rel="stylesheet" type="text/css" media="all"/>
    <link href="${pageContext.request.contextPath}/static/admin/css/sweetalert.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/home/css/jquery-labelauty.css" rel='stylesheet' type='text/css' />

    <!-- start-smoth-scrolling -->
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/move-top.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/easing.js"></script>
    <script src="${pageContext.request.contextPath}/static/home/js/jquery-labelauty.js"></script>

    <script src="${pageContext.request.contextPath}/static/admin/js/bootstrap-datetimepicker.js"></script>
    <script src="${pageContext.request.contextPath}/static/admin/js/bootstrap-datetimepicker.zh-CN.js"></script>
    <script src="${pageContext.request.contextPath}/static/home/js/jquery.easydropdown.js"></script>
    <script src="${pageContext.request.contextPath}/static/admin/js/sweetalert.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/admin/js/ajaxupload.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/bootstrapValidator.min.js"></script>

    <!-- start-smoth-scrolling -->
    <!-- webfonts -->
    <!-- webfonts -->
    <!-- start-smoth-scrolling -->
    <script type="text/javascript">
        jQuery(document).ready(function($) {
            $(".scroll").click(function(event){
                event.preventDefault();
                $('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
            });
        });
    </script>
    <!-- end-smoth-scrolling -->
    <style>
        ul.a { list-style-type: none;}
        li.a { display: inline-block;}
        li.a { margin: 10px 0;}
        input.labelauty + label { font: 12px "Microsoft Yahei";}
        .fadeInLeft .labelauty-checked{
            color: #FFFFFF;
        }

        .register-but input[type="button"] {
            background:#1BBC9B;
            color: #FFF;
            font-size: 1.2em;
            padding: 0.6em 2em;
            transition: 0.5s all;
            -webkit-transition: 0.5s all;
            -moz-transition: 0.5s all;
            -o-transition: 0.5s all;
            display: inline-block;
            text-transform: uppercase;
            border:none;
            outline:none;
        }
        .register-but input[type="button"]:hover {
            background:#000;
        }

        .leave .file {
            border: 1px solid #1BBC9B;
            color: #fff;
            font-size: 1em;
            width: 15%;
            margin: 1em 1em 0;
            padding: 0.3em;
            background: none;
            transition: 0.5s all;
            -webkit-transition: 0.5s all;
            -moz-transition: 0.5s all;
            -o-transition: 0.5s all;
            font-weight: 400;
            background: #1BBC9B;
        }

    </style>
</head>
<!-- Header Starts Here -->
<div class="banner inner-banner" >
    <%@include file="../header.jsp"%>

    <div id="breadcrumb_wrapper">
        <div class="container">

            <h2>简历编辑</h2>
            <!-- <h6>看看自己的简历吧！</h6> -->

            <div class="clearfix"></div>
        </div>
    </div>
</div>
<div class="clearfix"> </div>
<!-- Header Ends Here -->
<!--Main Starts Here-->

<div class="container">
    <div class="leave">
        <h3>编辑简历</h3>
        <h3><br></h3>

            <input type="hidden" id="resume_id" name="resume_id" value="${resume.resume_id}">
            <div class="single-grid">
                <div class="col-md-6 single-us">
                    <span>姓名</span>
                    <input type="text" id="realname" name="realname" placeholder="姓名" value="${resume.realname}">
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="single-grid">
                <div class="col-md-6 single-us">
                    <span>性别</span>
                    <p><br></p>
                    <ul class="a">
                        <li class="a"><input type="radio" name="sex" value="M" data-labelauty="男" <c:if test="${resume.sex=='M'}">checked</c:if>></li>
                        <li class="a"><input type="radio" name="sex" value="F" data-labelauty="女" <c:if test="${resume.sex=='F'}">checked</c:if>></li>
                    </ul>
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="single-grid ">
                <div class="col-md-6 single-us">
                    <span>生日</span>
                    <input type="text" id="birthday" name="birthday_string" placeholder="生日" value="${resume.birthday_string}">
                </div>
                <div class="clearfix"></div>
            </div>

            <div class="single-grid">
                <div class="col-md-6 single-us">
                    <span>民族</span>
                    <br>
                    <select id="people" name="people_id">
                        <c:forEach items="${peopleList}" var="item">
                            <c:choose>
                                <c:when test="${resume.people_id == item.people_id}">
                                    <option value="${item.people_id}" selected>${item.name}</option>
                                </c:when>
                                <c:otherwise>
                                    <option value="${item.people_id}">${item.name}</option>
                                </c:otherwise>
                            </c:choose>
                        </c:forEach>
                    </select>
                </div>
                <div class="clearfix"></div>
            </div>

            <div class="single-grid">
                <div class="col-md-6 single-us">
                    <span>学历</span>
                    <br>
                    <select id="degree" name="degree_id">
                        <c:forEach items="${degreeList}" var="item">
                            <c:choose>
                                <c:when test="${resume.degree_id == item.degree_id}">
                                    <option value="${item.degree_id}" selected>${item.degree_name}</option>
                                </c:when>
                                <c:otherwise>
                                    <option value="${item.degree_id}">${item.degree_name}</option>
                                </c:otherwise>
                            </c:choose>

                        </c:forEach>
                    </select>

                </div>
                <div class="clearfix"></div>
            </div>

            <div class="single-grid">
                <div class="col-md-6 single-us">
                    <span>籍贯</span>
                    <br>
                    <select id="input01" style="width:49%" onchange="changeZone('input01','input02')">
                        <c:forEach items="${zoneList}" var="item">
                            <option value="${item.zone_id}" <c:if test="${resume.origin_city.zone_id==item.zone_id}">selected</c:if>>${item.name}</option>
                        </c:forEach>
                    </select>
                    <select id="input02" style="width:50%" name="origin_city_id">
                        <c:forEach items="${originCityList}" var="item">
                            <option value="${item.city_id}" <c:if test="${resume.origin_city_id==item.city_id}">selected</c:if>>${item.name}</option>
                        </c:forEach>
                    </select>
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="single-grid">
                <div class="col-md-6 single-us">
                    <span>现住地</span>
                    <br>
                    <select id="input03" style="width:49%" onchange="changeZone('input03','input04')">
                        <c:forEach items="${zoneList}" var="item">
                            <option value="${item.zone_id}" <c:if test="${resume.live_city.zone_id==item.zone_id}">selected</c:if>>${item.name}</option>
                        </c:forEach>
                    </select>
                    <select id="input04" style="width:50%" name="live_city_id">
                        <c:forEach items="${liveCityList}" var="item">
                            <option value="${item.city_id}" <c:if test="${resume.live_city_id==item.city_id}">selected</c:if>>${item.name}</option>
                        </c:forEach>
                    </select>
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="single-grid">
                <div class="col-md-6 single-us">
                    <span>从事行业</span>
                    <select id="input05" name="industry_id" onchange="changeIndustry('input05','input07')">
                        <c:forEach items="${industryList}" var="item">
                            <option value="${item.industry_id}" <c:if test="${resume.industry_id==item.industry_id}">selected</c:if>>${item.industry_name}</option>
                        </c:forEach>
                    </select>
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="single-grid">
                <div class="col-md-6 single-us form-group">
                    <span>工作时间</span>
                    <input type="text" id="input06" name="work_year" value="${resume.work_year}" onkeydown="if(event.keyCode==13)event.keyCode=9" onkeypress="if ((event.keyCode<48 || event.keyCode>57)) event.returnValue=false" maxlength="10" placeholder="如 3">
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="single-grid">
                <div class="col-md-6 single-us">
                    <span>期望工作类型</span>
                    <select id="input07" name="expect_job_type_id">
                        <c:forEach items="${jobTypeList}" var="item">
                            <option value="${item.job_type_id}" <c:if test="${resume.expect_job_type_id==item.job_type_id}">selected</c:if>>${item.job_type_name}</option>
                        </c:forEach>
                    </select>
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="single-grid">
                <div class="col-md-6 single-us">
                    <span>期望工作</span>
                    <input type="text" id="input08" placeholder="期望工作" name="expect_job" value="${resume.expect_job}">
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="single-grid">
                <div class="col-md-6 single-us">
                    <span>期望工作地点</span>
                    <br>
                    <select id="input09" style="width:49%" onchange="changeZone('input09','input10')">
                        <c:forEach items="${zoneList}" var="item">
                            <option value="${item.zone_id}" <c:if test="${resume.expect_city.zone_id==item.zone_id}">selected</c:if>>${item.name}</option>
                        </c:forEach>
                    </select>
                    <select id="input10" style="width:50%" name="expect_city_id">
                        <c:forEach items="${expectCityList}" var="item">
                            <option value="${item.city_id}" <c:if test="${resume.expect_city_id==item.city_id}">selected</c:if>>${item.name}</option>
                        </c:forEach>
                    </select>
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="single-grid">
                <div class="col-md-6 single-us">
                    <span>期望工资</span>
                    <select id="input11" name="salary_type_id">
                        <c:forEach items="${salaryTypeList}" var="item">
                            <option value="${item.salary_type_id}" <c:if test="${resume.salary_type_id==item.salary_type_id}">selected</c:if>>${item.value}</option>
                        </c:forEach>
                    </select>
                </div>
                <div class="clearfix"></div>
            </div>

            <div class="text-top">
                <div class="col-md-8 text-in">
                    <span>自我评价</span>
                    <textarea id="input12" name="comment">${resume.comment}</textarea>
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="text-top" id="workExp">
                <c:forEach items="${workExpList}" var="item" varStatus="status">
                    <c:choose>
                        <c:when test="${status.count==1}">
                            <div class="col-md-8 text-in">
                                <h3>工作经历</h3>
                                <p><br></p>
                                <a href="javascript:void(0)" onclick="addNewExp()" style="color: #1BBC9B;">添加新的工作经历</a>
                                <p><br></p>
                                <input type="hidden" id="exp10" value="${item.work_exp_id}">
                                <input id="exp11" type="text" name="fromDate" class="single-us" placeholder="开始时间" value="${item.date_start_string}">
                                <span>至</span>
                                <input id="exp12" type="text" name="endDate" class="single-us" placeholder="结束时间" value="${item.date_end_string}">
                                <textarea id="exp13" placeholder="主要工作">${item.text}</textarea>
                            </div>
                            <div class="clearfix"></div>
                        </c:when>
                        <c:otherwise>
                            <div class="col-md-8 text-in">
                                <input type="hidden" id="exp${status.count}0" value="${item.work_exp_id}">
                                <input id="exp${status.count}1" type="text" name="fromDate" class="single-us" placeholder="开始时间" value="${item.date_start_string}">
                                <span>至</span>
                                <input id="exp${status.count}2" type="text" name="endDate" class="single-us" placeholder="结束时间" value="${item.date_end_string}">
                                <textarea id="exp${status.count}3" placeholder="主要工作">${item.text}</textarea>
                                <a href="javascript:void(0)" onclick="deleteElement(this)" style="color: red;">删除此工作经历</a>
                                <p><br></p>
                            </div>
                            <div class="clearfix"></div>
                        </c:otherwise>
                    </c:choose>
                </c:forEach>
                <c:if test="${workExpList.size()==0}">
                    <div class="col-md-8 text-in">
                        <h3>工作经历</h3>
                        <p><br></p>
                        <a href="javascript:void(0)" onclick="addNewExp()" style="color: #1BBC9B;">添加新的工作经历</a>
                        <p><br></p>
                        <input type="hidden" id="exp10">
                        <input id="exp11" type="text" name="fromDate" class="single-us" placeholder="开始时间">
                        <span>至</span>
                        <input id="exp12" type="text" name="endDate" class="single-us" placeholder="结束时间">
                        <textarea id="exp13" placeholder="主要工作"></textarea>
                    </div>
                    <div class="clearfix"></div>
                </c:if>
            </div>
            <c:choose>
                <c:when test="${workExpList.size()==0}">
                    <input type="hidden" id="exp_num" value="1">
                </c:when>
                <c:otherwise>
                    <input type="hidden" id="exp_num" value="${workExpList.size()}">
                </c:otherwise>
            </c:choose>

            <div class="text-top" id="eduExp">
                <c:forEach items="${educationList}" var="item" varStatus="status">
                    <c:choose>
                        <c:when test="${status.count==1}">
                            <div class="col-md-8 text-in">
                                <h3>教育经历</h3>
                                <p><br></p>
                                <a href="javascript:void(0)" onclick="addNewEdu()" style="color: #1BBC9B;">添加新的教育经历</a>
                                <p><br></p>
                                <input type="hidden" id="edu10" value="${item.education_id}">
                                <input type="text" id="edu11" class="single-us" placeholder="开始时间" value="${item.date_start_string}">
                                <span>至</span>
                                <input type="text" id="edu12" class="single-us" placeholder="结束时间" value="${item.date_end_string}">
                                <input type="text" id="edu13" class="single-us" placeholder="就读学校" value="${item.school}" style="width: 80%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 1em 0;">
                                <p><br></p>
                            </div>
                            <div class="clearfix"></div>
                        </c:when>
                        <c:otherwise>
                            <div class="col-md-8 text-in">
                                <input type="hidden" id="edu${status.count}0" value="${item.education_id}">
                                <input type="text" id="edu${status.count}1" class="single-us" placeholder="开始时间" value="${item.date_start_string}">
                                <span>To</span>
                                <input type="text" id="edu${status.count}2" class="single-us" placeholder="结束时间" value="${item.date_end_string}">
                                <input type="text" id="edu${status.count}3"  class="single-us" placeholder="就读学校" value="${item.school}" style="width: 100%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 1em 0;">
                                <p><br></p>
                                <a href="javascript:void(0)" onclick="deleteElement(this)" style="color: red;">删除此教育经历</a>
                                <p><br></p>
                            </div>
                        </c:otherwise>
                    </c:choose>
                </c:forEach>
                <c:if test="${educationList.size()==0}">
                    <div class="col-md-8 text-in">
                        <h3>教育经历</h3>
                        <p><br></p>
                        <a href="javascript:void(0)" onclick="addNewEdu()" style="color: #1BBC9B;">添加新的教育经历</a>
                        <p><br></p>
                        <input type="hidden" id="edu10">
                        <input type="text" id="edu11" class="single-us" placeholder="开始时间">
                        <span>至</span>
                        <input type="text" id="edu12" class="single-us" placeholder="结束时间">
                        <input type="text" id="edu13" class="single-us" placeholder="就读学校" style="width: 80%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 1em 0;">
                        <p><br></p>
                    </div>
                    <div class="clearfix"></div>
                </c:if>
            </div>
            <c:choose>
                <c:when test="${educationList.size()==0}">
                    <input type="hidden" id="edu_num" value="1">
                </c:when>
                <c:otherwise>
                    <input type="hidden" id="edu_num" value="${educationList.size()}">
                </c:otherwise>
            </c:choose>

            <div class="text-top" id="comExp">
                <c:forEach items="${competitionExpList}" var="item" varStatus="status">
                    <c:choose>
                        <c:when test="${status.count==1}">
                            <div class="col-md-8 text-in">
                                <h3>竞赛经历</h3>
                                <p><br></p>
                                <a href="javascript:void(0)" onclick="addNewCom()" style="color: #1BBC9B;">添加新的竞赛经历</a>
                                <p><br></p>
                                <input type="hidden" id="com10" value="${item.competition_exp_id}">
                                <input type="text" id="com11" value="${item.name}" class="single-us" placeholder="比赛名称" style="width: 80%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 0.5em 0;">
                                <input type="text" id="com12" value="${item.obtain}" class="single-us" placeholder="比赛名次" style="width: 80%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 0.5em 0;">
                                <input type="text" id="com13" value="${item.date_string}" class="single-us" placeholder="获奖时间" style="width: 80%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 0.5em 0;">
                                <p><br></p>
                            </div>
                            <div class="clearfix"></div>
                        </c:when>
                        <c:otherwise>
                            <div class="col-md-8 text-in">
                                <input type="hidden" id="com${status.count}0" value="${item.competition_exp_id}">
                                <input type="text" id="com${status.count}1" value="${item.name}" class="single-us" placeholder="比赛名称" style="width: 80%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 0.5em 0;">
                                <input type="text" id="com${status.count}2" value="${item.obtain}" class="single-us" placeholder="比赛名次" style="width: 80%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 0.5em 0;">
                                <input type="text" id="com${status.count}3" value="${item.date_string}" class="single-us" placeholder="获奖时间" style="width: 80%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 0.5em 0;">
                                <p><br></p>
                                <a href="javascript:void(0)" onclick="deleteElement(this)" style="color: red;">删除此竞赛经历</a>
                                <p><br></p>
                            </div>
                        </c:otherwise>
                    </c:choose>
                </c:forEach>
                <c:if test="${competitionExpList.size()==0}">
                    <div class="col-md-8 text-in">
                        <h3>竞赛经历</h3>
                        <p><br></p>
                        <a href="javascript:void(0)" onclick="addNewCom()" style="color: #1BBC9B;">添加新的竞赛经历</a>
                        <p><br></p>
                        <input type="hidden" id="com10">
                        <input type="text" id="com11" class="single-us" placeholder="比赛名称" style="width: 80%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 0.5em 0;">
                        <input type="text" id="com12" class="single-us" placeholder="比赛名次" style="width: 80%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 0.5em 0;">
                        <input type="text" id="com13" class="single-us" placeholder="获奖时间" style="width: 80%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 0.5em 0;">
                        <p><br></p>
                    </div>
                    <div class="clearfix"></div>
                </c:if>
            </div>
            <c:choose>
                <c:when test="${competitionExpList.size()==0}">
                    <input type="hidden" id="com_num" value="1">
                </c:when>
                <c:otherwise>
                    <input type="hidden" id="com_num" value="${competitionExpList.size()}">
                </c:otherwise>
            </c:choose>

            <div class="text-top" id="skill" name="skillList">
                <c:forEach items="${skillList}" var="item" varStatus="status">
                    <c:choose>
                        <c:when test="${status.count==1}">
                            <div class="col-md-8 text-in">
                                <h3>工作技能</h3>
                                <p><br></p>
                                <a href="javascript:void(0)" onclick="addNewSkill()" style="color: #1BBC9B;">添加新的工作技能</a>
                                <p><br></p>
                                <input type="hidden" id="skill10" value="${item.skill_id}">
                                <input type="text" id="skill11" value="${item.name}" name="name" class="single-us" placeholder="技能名称" style="width: 80%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 0.5em 0;">
                                <p><br></p>
                            </div>
                            <div class="clearfix"></div>
                        </c:when>
                        <c:otherwise>
                            <div class="col-md-8 text-in">
                                <input type="hidden" id="skill${status.count}0" value="${item.skill_id}">
                                <input type="text" id="skill${status.count}1" value="${item.name}" class="single-us" placeholder="技能名称" style="width: 80%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 0.5em 0;">
                                <p><br></p>
                                <a href="javascript:void(0)" onclick="deleteElement(this)" style="color: red;">删除此工作技能</a>
                                <p><br></p>
                            </div>
                        </c:otherwise>
                    </c:choose>
                </c:forEach>
                <c:if test="${skillList.size()==0}">
                    <div class="col-md-8 text-in">
                        <h3>工作技能</h3>
                        <p><br></p>
                        <a href="javascript:void(0)" onclick="addNewSkill()" style="color: #1BBC9B;">添加新的工作技能</a>
                        <p><br></p>
                        <input type="hidden" id="skill10">
                        <input type="text" id="skill11" name="name" class="single-us" placeholder="技能名称" style="width: 80%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 0.5em 0;">
                        <p><br></p>
                    </div>
                    <div class="clearfix"></div>
                </c:if>
            </div>
            <c:choose>
                <c:when test="${skillList.size()==0}">
                    <input type="hidden" id="skill_num" value="1">
                </c:when>
                <c:otherwise>
                    <input type="hidden" id="skill_num" value="${skillList.size()}">
                </c:otherwise>
            </c:choose>

            <div class="text-top" id="fileupload">
                <div class="col-md-8 text-in">
                    <h3>上传简历</h3>
                    <p><br></p>
                    <input type="text" name="filename" id="filename" readonly value="${resume.attachment}">
                    <a class="file" style="cursor: pointer">选择文件<input id="input13" type="file" name="input13" multiple="" style="cursor: pointer">
                    </a>
                    <p><br></p>
                    <div class="register-but">
                        <a class="read-more" href="javascript:save()"><input type="button" value="提交"></a>
                    </div>
                    <p><br></p>
                </div>
            </div>
    </div>
</div>

<!--Main Ends Here-->


<!-- #Footer -->
<%@include file="../footer.jsp"%>
<!-- /#Footer -->
<!-- here stars scrolling icon -->
<script type="text/javascript">

    $(document).ready(function() {
        /*
         var defaults = {
         containerID: 'toTop', // fading element id
         containerHoverID: 'toTopHover', // fading element hover id
         scrollSpeed: 1200,
         easingType: 'linear'
         };
         */

        $().UItoTop({ easingType: 'easeOutQuart' });

    });

    $(function(){
        date_picker('birthday');
        date_picker('exp11');
        date_picker('exp12');
        date_picker('edu11');
        date_picker('edu12');
        date_picker('com13');
        <c:if test="${workExpList.size()!=0}">
            <c:forEach items="${workExpList}" var="item" varStatus="status">
                date_picker('exp'+'${status.count}'+1);
                date_picker('exp'+'${status.count}'+2);
            </c:forEach>
        </c:if>

        <c:if test="${educationList.size()!=0}">
            <c:forEach items="${educationList}" var="item" varStatus="status">
                date_picker('edu'+'${status.count}'+1);
                date_picker('edu'+'${status.count}'+2);
            </c:forEach>
        </c:if>
        <c:if test="${competitionExpList.size()!=0}">
            <c:forEach items="${competitionExpList}" var="item" varStatus="status">
                date_picker('com'+'${status.count}'+3);
            </c:forEach>
        </c:if>
    });


    function addNewExp() {
        var len = $('#exp_num').val();
        var num = parseInt(len)+1;
        var str = 'exp'+num;
        var string = $('#workExp').html();
        var values=[];
        for(var i= len; i >= 1; i--){
            var arr = [];
            arr[0] = $('#exp' + i + 0).val();
            arr[1] = $('#exp' + i + 1).val();
            arr[2] = $('#exp' + i + 2).val();
            arr[3] = $('#exp' + i + 3).val();
            values[i] = arr;
        }
        string +=
                '<div class="col-md-8 text-in">' +
                '<input type="hidden" id="' + str+0 + '">' +
                '<input id="' + str+1 + '" type="text" name="fromDate" class="single-us" placeholder="开始时间">' +
                '<span>至</span>' +
                '<input id="' + str+2 + '" type="text" name="endDate" class="single-us" placeholder="结束时间">' +
                '<textarea id="' + str+3 + '" placeholder="主要工作"></textarea>' +
                '<a href="javascript:void(0)" onclick="deleteElement(this)" style="color: red;">删除此工作经历</a>' +
                '<p><br></p>' +
                '</div>' +
                '<div class="clearfix"></div>';
        $('#workExp').html(string);

        for(var i= len; i >= 1; i--){
            $('#exp' + i + 0).val(values[i][0]);
            $('#exp' + i + 1).val(values[i][1]);
            $('#exp' + i + 2).val(values[i][2]);
            $('#exp' + i + 3).val(values[i][3]);
            date_picker('exp' + i + 1);
            date_picker('exp' + i + 2);
        }
        date_picker(str + 1);
        date_picker(str + 2);
        $('#exp_num').val(num);
    }

    function addNewEdu() {
        var len = $('#edu_num').val();
        var num = parseInt(len)+1;
        var str = 'edu'+num;
        var values=[];
        for(var i= len; i >= 1; i--){
            var arr = [];
            arr[0] = $('#edu' + i + 0).val();
            arr[1] = $('#edu' + i + 1).val();
            arr[2] = $('#edu' + i + 2).val();
            arr[3] = $('#edu' + i + 3).val();
            values[i] = arr;
        }
        var string = $('#eduExp').html();
        string +=
                '<div class="col-md-8 text-in">' +
                '<input type="hidden" id="' + str+0 + '">' +
                '<input type="text" id="'+str+1+'" class="single-us" placeholder="开始时间">' +
                '<span>To</span>' +
                '<input type="text" id="'+str+2+'" class="single-us" placeholder="结束时间">' +
                '<input type="text" id="'+str+3+'"  class="single-us" placeholder="就读学校" style="width: 100%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 1em 0;">' +
                '<p><br></p>' +
                '<a href="javascript:void(0)" onclick="deleteElement(this)" style="color: red;">删除此教育经历</a>' +
                '<p><br></p>' +
                '</div>';
        $('#eduExp').html(string);

        for(var i= len; i >= 1; i--){
            $('#edu' + i + 0).val(values[i][0]);
            $('#edu' + i + 1).val(values[i][1]);
            $('#edu' + i + 2).val(values[i][2]);
            $('#edu' + i + 3).val(values[i][3]);
            date_picker('edu' + i + 1);
            date_picker('edu' + i + 2);
        }
        date_picker(str + 1);
        date_picker(str + 2);
        $('#edu_num').val(num);
    }

    function addNewCom() {
        var len = $('#com_num').val();
        var num = parseInt(len)+1;
        var str = 'com'+num;
        var values=[];
        for(var i= len; i >= 1; i--){
            var arr = [];
            arr[0] = $('#com' + i + 0).val();
            arr[1] = $('#com' + i + 1).val();
            arr[2] = $('#com' + i + 2).val();
            arr[3] = $('#com' + i + 3).val();
            values[i] = arr;
        }
        var string = $('#comExp').html();
        string +=
                '<div class="col-md-8 text-in">' +
                '<input type="hidden" id="' + str+0 + '">' +
                '<input type="text" id="'+str+1+'" class="single-us" placeholder="比赛名称" style="width: 80%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 0.5em 0;">' +
                '<input type="text" id="'+str+2+'" class="single-us" placeholder="比赛名次" style="width: 80%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 0.5em 0;">' +
                '<input type="text" id="'+str+3+'" class="single-us" placeholder="获奖时间" style="width: 80%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 0.5em 0;">' +
                '<p><br></p>' +
                '<a href="javascript:void(0)" onclick="deleteElement(this)" style="color: red;">删除此竞赛经历</a>' +
                '<p><br></p>'+
                '</div>';
        $('#comExp').html(string);

        for(var i= len; i >= 1; i--){
            $('#com' + i + 0).val(values[i][0]);
            $('#com' + i + 1).val(values[i][1]);
            $('#com' + i + 2).val(values[i][2]);
            $('#com' + i + 3).val(values[i][3]);
            date_picker('com' + i + 3);
        }
        date_picker(str + 3);
        $('#com_num').val(num);
    }

    function addNewSkill() {
        var len = $('#skill_num').val();
        var num = parseInt(len)+1;
        var str = 'skill'+num;
        var values=[];
        for(var i= len; i >= 1; i--){
            var arr=[];
            arr[0] = $('#skill' + i + 0).val();
            arr[1] = $('#skill' + i + 1).val();
            values[i] = arr;
        }
        var string = $('#skill').html();
        string +=
                '<div class="col-md-8 text-in">' +
                '<input type="hidden" id="' + str+0 + '">' +
                '<input type="text" id="'+str+1+'" class="single-us" placeholder="技能名称" style="width: 80%; border: 1px solid #EEE; outline-color:#1BBC9B; font-size: 1em; padding: 0.5em; margin: 0.5em 0;">' +
                '<p><br></p>' +
                '<a href="javascript:void(0)" onclick="deleteElement(this)" style="color: red;">删除此工作技能</a>' +
                '<p><br></p>' +
                '</div>';
        $('#skill').html(string);

        for(var i=len; i >= 1; i--) {
            $('#skill' + i + 0).val(values[i][0]);
            $('#skill' + i + 1).val(values[i][1]);
        }
        $('#skill_num').val(num);
    }

    function deleteElement(_element) {
        var _parentElement = _element.parentNode;
        console.log(_parentElement);
        var childs = _parentElement.childNodes;
        for(var i = childs.length - 1; i >= 0; i--) {
            _parentElement.removeChild(childs[i]);
        }
    }

    function chooseFile() {

    }

    function readFile(file){
        var f = file.files[0];
        var reader = new FileReader();
        reader.readAsDataURL(f);
        reader.onload = function(e){
            $('#filename').attr('src',this.result);
        }
    }

    $(function () {
        $('.file').on('change',"input[type='file']",  function() {
            var input = $(this),
                    numFiles = input.get(0).files ? input.get(0).files.length : 1,
                    label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
            var input1 = $(this).parents('#fileupload').find(':text'),
                    log = numFiles > 1 ? numFiles + ' files selected' : label;
            if( input1.length ) {
                input1.val(log);
            } else {
                if( log ) alert(log);
            }

        });
    })

    function changeZone(id1,id2){
        var zone_id = $('#'+id1).val();
        $.ajax({
            type:'post',
            url:'${pageContext.request.contextPath}/home/resume/getCityList.action',
            data:'zone_id='+zone_id,
            success:function(data){
                var string="";
                for(var i in data){
                    string +='<option value="'+data[i].city_id+'">'+data[i].name+'</option>';
                }
                $('#'+id2).html(string);
                $('#'+id2).trigger("chosen:updated");
            }

        });
    }

    function changeIndustry(id1,id2){
        var industry_id = $('#'+id1).val();
        $.ajax({
            type:'post',
            url:'${pageContext.request.contextPath}/home/resume/getJobTypeList.action',
            data:'industry_id='+industry_id,
            success:function(data){
                var string="";
                for(var i in data){
                    string +='<option value="'+data[i].job_type_id+'">'+data[i].job_type_name+'</option>';
                }
                $('#'+id2).html(string);
                $('#'+id2).trigger("chosen:updated");
            }

        });
    }


</script>

<script>
    function date_picker(id) {
        $('#' + id).datetimepicker({
            fontAwesome: 1,
            format: "yyyy-mm-dd",
            weekStart: 1,
            todayBtn: 1,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            forceParse: 0,
            showMeridian: 0,
            minView: "month"
        });

        $("#" + id).on("dp.show", function (e) {
            var newtop = $('.bootstrap-datetimepicker-widget').position().top - 45;
            $('.bootstrap-datetimepicker-widget').css('top', newtop + 'px');
        })
    };

    var count=0;

    //finish
    function saveResume() {
        var realname = $('#realname').val();
        var sex = $('input:radio[name=sex]:checked').val();
        var birthday_string = $('#birthday').val();
        var people_id = $('#people').val();
        var degree_id = $('#degree').val();
        var origin_city_id = $('#input02').val();
        var live_city_id = $('#input04').val();
        var industry_id = $('#input05').val();
        var work_year = $('#input06').val();
        var expect_job_type_id = $('#input07').val();
        var expect_job = $('#input08').val();
        var expect_city_id = $('#input10').val();
        var salary_type_id = $('#input11').val();
        var comment = $('#input12').val();
        console.log(comment);
        if(realname == "" || birthday_string == "" || sex == "" || origin_city_id == "" || live_city_id == ""
                || industry_id=="" || expect_job_type_id=="" || expect_job=="" || expect_city_id=="" || salary_type_id==""){
            swal("","请填写完整用户信息！","error");
            return;
        }
        $.ajaxFileUpload({
            url : '${pageContext.request.contextPath}/home/resume/saveResume.action', //用于文件上传的服务器端请求地址
            secureuri : false, //一般设置为false
            fileElementId : 'input13', //文件上传空间的id属性  <input type="file" id="file" name="file" />
            type : 'post',
            dataType : 'json', //返回值类型 一般设置为json
            data:{
                resume_id:${resume.resume_id},
                realname:realname,
                sex:sex,
                birthday_string:birthday_string,
                people_id:people_id,
                degree_id:degree_id,
                origin_city_id:origin_city_id,
                live_city_id:live_city_id,
                industry_id:industry_id,
                work_year:work_year,
                expect_job_type_id:expect_job_type_id,
                expect_job:expect_job,
                expect_city_id:expect_city_id,
                salary_type_id:salary_type_id,
                comment:comment
            },
            success : function(data, status) //服务器成功响应处理函数
            {
                console.log(data);
                if(data == -1){
                    swal("","请填写完整用户信息！","error");
                }
                if(data == 1){
                    count++;
                    console.log(count);
                    if (count ==5) {
                        swal("","保存成功！","success");
                    }
                }else{
                    swal("","服务器出错！","error");
                }
                // alert(data.msg);
            },
            error : function(data, status, e)//服务器响应失败处理函数
            {
                swal("","服务器出错！","error");
                // alert(data.msg);
            }
        });
        return false;
    }

    function saveExp() {
        var len = $('#exp_num').val();
        var values=[];
        for(var i= len; i >= 1; i--){
            var arr = [];
            arr[0] = $('#exp' + i + 0).val();
            arr[1] = $('#exp' + i + 1).val();
            arr[2] = $('#exp' + i + 2).val();
            arr[3] = $('#exp' + i + 3).val();
            values[i] = arr;
        }
        console.log(values);

        var data = {"resume_id":${resume.resume_id},"arr":values};
        $.ajax({
            type:'post',
            url:'${pageContext.request.contextPath}/home/resume/saveWorkExp.action',
            contentType:'application/json;charset=utf-8',
            data:JSON.stringify(data),
            success:function(data){
                if(data == -1){
                    swal("","请填写完整用户信息！","error");
                }
                if(data == 1){
                    count++;
                    console.log(count);
                    if (count ==5) {
                        swal("","保存成功！","success");
                    }
                }else{
                    swal("","服务器出错！","error");
                }
            }
        });
    }

    function saveEdu() {
        var len = $('#edu_num').val();
        var values=[];
        for(var i= len; i >= 1; i--){
            var arr = [];
            arr[0] = $('#edu' + i + 0).val();
            arr[1] = $('#edu' + i + 1).val();
            arr[2] = $('#edu' + i + 2).val();
            arr[3] = $('#edu' + i + 3).val();
            values[i] = arr;
        }
        console.log(values);

        var data = {"resume_id":${resume.resume_id},"arr":values};
        $.ajax({
            type:'post',
            url:'${pageContext.request.contextPath}/home/resume/saveEdu.action',
            contentType:'application/json;charset=utf-8',
            data:JSON.stringify(data),
            success:function(data){
                if(data == -1){
                    swal("","请填写完整用户信息！","error");
                }
                if(data == 1){
                    count++;
                    console.log(count);
                    if (count == 5) {
                        swal("","保存成功！","success");
                    }
                }else{
                    swal("","服务器出错！","error");
                }
            }
        });
    }

    function saveComExp() {
        var len = $('#com_num').val();
        var values=[];
        for(var i= len; i >= 1; i--){
            var arr = [];
            arr[0] = $('#com' + i + 0).val();
            arr[1] = $('#com' + i + 1).val();
            arr[2] = $('#com' + i + 2).val();
            arr[3] = $('#com' + i + 3).val();
            values[i] = arr;
        }
        console.log(values);

        var data = {"resume_id":${resume.resume_id},"arr":values};
        $.ajax({
            type:'post',
            url:'${pageContext.request.contextPath}/home/resume/saveComExp.action',
            contentType:'application/json;charset=utf-8',
            data:JSON.stringify(data),
            success:function(data){
                if(data == -1){
                    swal("","请填写完整用户信息！","error");
                }
                if(data == 1){
                    count++;
                    console.log(count);
                    if (count == 5) {
                        swal("","保存成功！","success");
                    }
                }else{
                    swal("","服务器出错！","error");
                }
            }
        });
    }

    function saveSkill() {
        var len = $('#skill_num').val();
        var values=[];
        for(var i= len; i >= 1; i--){
            var arr = [];
            arr[0] = $('#skill' + i + 0).val()
            arr[1] = $('#skill' + i + 1).val()
            values[i] = arr;
        }
        console.log(values);

        var data = {"resume_id":${resume.resume_id},"arr":values};
        $.ajax({
            type:'post',
            url:'${pageContext.request.contextPath}/home/resume/saveSkill.action',
            contentType:'application/json;charset=utf-8',
            data:JSON.stringify(data),
            success:function(data){
                if(data == -1){
                    swal("","请填写完整用户信息！","error");
                }
                if(data == 1){
                    count++;
                    console.log(count);
                    if (count == 5) {
                        swal("","保存成功！","success");
                    }
                }else{
                    swal("","服务器出错！","error");
                }
            }
        });
    }

    function save() {
        saveResume();
        saveExp();
        saveComExp();
        saveEdu();
        saveSkill();
    }
</script>

<script>
    $(function(){
        $(':input').labelauty();
    });
</script>


<!-- //here ends scrolling icon -->
</body>
</html>
